<?php

/**
 * @author christian
 * @copyright 2011
 *  
 */
 

 //establecer una variable conratafisica $_LOCALHOST
$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDTour";
include_once("$ruta/star.php");
//include_once("$rut/conf/CConfig.php");


/** Datos del guia  */

 
if (!isset($_GET['servicio'])) {$_GET['servicio'] = "NULL"; }
$servicio=$_GET['servicio'];
 
if (!isset($_GET['default'])) {$_GET['default'] = "NULL"; }
$default=$_GET['default'];

if (!isset($_POST['idGuide'])) {$_POST['idGuide'] = "NULL"; }
if (!isset($_POST['LastNamGui'])) {$_POST['LastNamGui'] = "NULL"; }
if (!isset($_POST['FirstNamGui'])) {$_POST['FirstNamGui'] = "NULL"; }
if (!isset($_POST['BornDateGui'])) {$_POST['BornDateGui'] = "NULL"; }
if (!isset($_POST['TelGui'])) {$_POST['TelGui'] = "NULL"; }
if (!isset($_POST['FaxGui'])) {$_POST['FaxGui'] = "NULL"; }
if (!isset($_POST['MailGui'])) {$_POST['MailGui'] = "NULL"; }
if (!isset($_POST['WebPagGui'])) {$_POST['WebPagGui'] = "NULL"; }
if (!isset($_POST['DocNumGui'])) {$_POST['DocNumGui'] = "NULL"; }
if (!isset($_POST['LimBloGui'])) {$_POST['LimBloGui'] = "NULL"; }
if (!isset($_POST['LimResGui'])) {$_POST['LimResGui'] = "NULL"; }
if (!isset($_POST['PricPerSer'])) {$_POST['PricPerSer'] = "NULL"; }
if (!isset($_POST['ClasGui'])) {$_POST['ClasGui'] = "NULL"; }
if (!isset($_POST['GuiOrTc'])) {$_POST['GuiOrTc'] = "NULL"; }
if (!isset($_POST['DescGui'])) {$_POST['DescGui'] = "NULL"; }
if (!isset($_POST['CUENTA_idCue'])) {$_POST['CUENTA_idCue'] = "NULL"; }
if (!isset($_POST['CUENTA_BANCO_idBan'])) {$_POST['CUENTA_BANCO_idBan'] = "NULL"; }
if (!isset($_POST['CITY_idCit'])) {$_POST['CITY_idCit'] = "NULL"; }

$idGuide=$_POST['idGuide'];
$FirstNamGui=$_POST['FirstNamGui'];
$LastNamGui=$_POST['LastNamGui'];
$BornDateGui=$_POST['BornDateGui'];
$DocNumGui=$_POST['DocNumGui'];
$TelGui=$_POST['TelGui'];
$FaxGui=$_POST['FaxGui'];
$MailGui=$_POST['MailGui'];
$WebPagGui=$_POST['WebPagGui'];
$LimBloGui=$_POST['LimBloGui'];
$LimResGui=$_POST['LimResGui'];
$PricPerSer=$_POST['PricPerSer'];
$ClasGui=$_POST['ClasGui'];
$GuiOrTc=$_POST['GuiOrTc'];
$DescGui=$_POST['DescGui'];
$CUENTA_idCue=$_POST['CUENTA_idCue'];
$CUENTA_BANCO_idBan=$_POST['CUENTA_BANCO_idBan'];
$CITY_idCit=$_POST['CITY_idCit'];

if($default==1){ // registrar
   

    $querybasic  = "insert into guidetc (idGuide,FirstNamGui,LastNamGui,BornDateGui,DocNumGui,TelGui,FaxGui,MailGui,WebPagGui,LimBloGui,LimResGui,PricPerSer,	
    ClasGui,GuiOrTc,DescGui,CUENTA_idCue,CUENTA_BANCO_idBan,CITY_idCit) into ('$idGuide','$FirstNamGui','$LastNamGui','$BornDateGui','$DocNumGui','$TelGui','$FaxGui','$MailGui','$WebPagGui','$LimBloGui','$LimResGui','$PricPerSer',	
    '$ClasGui','$GuiOrTc','$DescGui','$CUENTA_idCue','$CUENTA_BANCO_idBan','$CITY_idCit')";
 
            
    $idGuide = CModelo::getInstance()->insertData($querybasic);

                 echo "<script> parent.location.href = '../index.php' </script>";
    }

else{ // actualizar
     
       
    }
    
      
      
if($servicio==1){
    
    if (!isset($_POST['idGuide'])) {$_POST['idGuide'] = "NULL"; }
    if (!isset($_POST['DesRes'])) {$_POST['DesRes'] = "NULL"; }
    if (!isset($_POST['CanIteRec'])) {$_POST['CanIteRec'] = "NULL"; }
    if (!isset($_POST['PriUni'])) {$_POST['PriUni'] = "NULL"; }
    if (!isset($_POST['CommSer'])) {$_POST['CommSer'] = "NULL"; }

    $idGuide =$_POST['idGuide'];
    $DesSer=$_POST['DesSer'];
    $CanIteRec=$_POST['CanIteRec'];
    $PriUni=$_POST['PriUni'];
    $CommSer=$_POST['CommSer'];
    
    $qu = "insert pack_has_tour_has_guidetc (guidetc_idGuide,DesSer,CanIteRec,PriUni,CommSer,SerFlag) 
    values ('$idGuide','$DesSer','$CanIteRec','$PriUni','$CommSer','1')";
    
    $idt = CModelo::getInstance()->insertData($qu);

    echo "<script> parent.location.href = '../index.php' </script>";
    
}        
        
 
//include_once("$rut/elements/head.tpl");
include_once("$rut/elements/foot.tpl");







?>